package com.test.component;

import com.test.model.Student;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * @Author：徐志荣
 * @Date：2023/6/7 下午 7:09
 */

//同⼀类型多个 @Bean 报错

@Component
public class StudentBeans3 {

    @Bean
    public Student stu1(){
        Student student = new Student();
        student.setAge(18);
        student.setId(1);
        student.setName("张三");
        return student;
    }

    @Bean
    public Student stu2(){
        Student student = new Student();
        student.setAge(28);
        student.setId(2);
        student.setName("李四");
        return student;
    }
}
